package com.bjsxt.socketdemo;

import java.net.MalformedURLException;
import java.net.URL;

public class UrlTest {
    public static void main(String[] args) throws MalformedURLException {
        URL url = new URL("http://arxiv.org/pdf/1904.10669.pdf");

        System.out.println("获取与此URL相关联协议的默认端口："+url.getDefaultPort());
        System.out.println("访问资源："+url.getFile());
        System.out.println("主机名："+url.getHost());
        System.out.println("访问资源路径："+url.getPath());
        System.out.println("协议："+url.getProtocol());
        System.out.println("参数部分："+url.getQuery());

    }
}
